﻿program Laurch;

// {$APPTYPE CONSOLE}
uses
  Windows, SysUtils,
  Header in 'Header.pas';

var
  msg: TMsg;
  h: Integer;

begin
  { IFDEF CONSOLE }
  (*
    WriteLn(' ========= Demonstration ======== ');
    WriteLn(' ===== Press ESCAPE to EXIT ===== ');
    WriteLn(' ===== Use LEFT MOUSE BUTTON to rotate the scene');
    WriteLn(' ===== Use RIGHT MOUSE BUTTON to pan');
    WriteLn(' ===== Use Z and X buttons to roll the scene (additional rotate angle)');
    WriteLn(' ===== Use MOUSE WHEEL to scale the scene');
    WriteLn(' ===== Use C to get back to origin camera position');
    *)
  { ENDIF }

  if not FileExists('settings.txt') then
    raise Exception.Create('Không tìm thấy tệp thông số!!!');
  renderInit('settings.txt');
  h := renderWindowGetHandle();
  repeat
    if PeekMessage(msg, 0, 0, 0, PM_NOREMOVE) then
    begin
      if GetMessage(msg, 0, 0, 0) then
      begin
        TranslateMessage(msg);
        DispatchMessage(msg);
      end;
    end
    else
    begin
      SendMessage(h, 15, 0, 0); // WM_PAINT
    end;
  until GetAsyncKeyState(VK_ESCAPE) < 0;
  renderDeInit;
end.
